#include<iostream>
using namespace std;

/*
	@description: input a integer number n, output it's factorial.
*/
int main()
{
    while(true)
    {
        int n=0,h=0;
        unsigned short s[100000]= {0};
        cin>>n;
        if(n<0)
        {
            s[0]=0;
        }
        else if(n<=1)
        {
            s[0]=1;
        }
        else if(n>10000)
        {
            return -1;
        }
        else
        {
            s[0]=1;
            for(int i=2; i<=n; i++)
            {
                int j=0,p=0;
                while(j<=h)
                {
                    int sum=(s[j]*i+p);
                    s[j]=sum % 10;
                    p=sum/10;
                    j++;
                }

                while(p>0)
                {
                    s[++h]=p%10;
                    p=p/10;
                }
            }
        }

        for(int i=h; i>=0; i--)
        {
            cout<<s[i];
        }
        cout<<endl;
    }
    return 1;
}
